import type { AxiosResponseType } from '@/types/http'
import { requestAPI } from '@/utils/http/request'

/**
 *  获取任务列表
 * @param data
 * @returns
 */
export const getTaskList = (status: string, netName: string, pageNo: number, pageSize: number) => {
  let url = `/admin-api/business/task/news/page?pageNo=${pageNo}&pageSize=${pageSize}`
  if (status.trim() !== '') {
    url += `&status=${status.trim()}`
  }
  if (netName.trim() !== '') {
    url += `&netName=${netName.trim()}`
  }
  return requestAPI.get<AxiosResponseType<{ list: any[]; total: number }>>(url)
}
/**
 * 启动任务
 * @param id
 * @returns
 */
export const startTask = (id: number) => {
  const url = `/admin-api/business/task/news/start/${id}`
  return requestAPI.get<AxiosResponseType<any>>(url)
}
/**
 * 暂停任务
 * @param id
 * @returns
 */
export const stopTask = (id: number) => {
  const url = `/admin-api/business/task/news/stop/${id}`
  return requestAPI.get<AxiosResponseType<any>>(url)
}
// /**
//  * 多模态抽取详情
//  * @param data
//  * @returns
//  */
// export const getMediaTaskDetail = (data: { task_id: number }) => {
//   const url = `/new/extract_task_detail/`
//   return requestNewAPI.post<MediaTaskDetail>(url, data, {
//     'Content-Type': 'multipart/form-data',
//   })
// }
